<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>


<script type="text/javascript" src="Content/js/taikhoan.js"></script>

<link rel="stylesheet" type="text/css"
	href="Content/css/Admin/lietKeTaiKhoan.css" />
<link rel="stylesheet" type="text/css"
	href="Content/css/Admin/lietKeComment.css" />	

<div class="main_content">
	<div class="mycolor"><h4>${requestScope.title }<c:if test="${requestScope.usercm!=null }"> "${usercm.userId }"</c:if></h4></div>
	<c:if test="${requestScope.bookcm !=null }">
		<div class="mybook ">
					<div id="image">
						<a href="ChiTietSach.do?bookid=${requestScope.bookcm.bookId }"><img class="img-rounded" alt="140x140" src="${bookcm.imageUrl }"></a>	
					</div>
					<div id="content">
						<div id="name"><a title="${bookcm.name }" href="ChiTietSach.do?bookid=${bookcm.bookId }"><c:out value="${bookcm.name }"></c:out></a></div>
					<table  class="table" style="text-transform:capitalize;">
					<tbody>
						<tr><td>Tác giả:</td><td><c:if test="${bookcm.author.name != ''}"><a href="TacGia.do?save=false&tacgiaid=${bookcm.author.authorId}&trang=1&slbooktt=${requestScope.soBookTrenTrang}&kieuSort=${requestScope.kieuSapXep}"><c:out value="${bookcm.author.name }"></c:out></a></c:if>			</td></tr>
						<c:if test="${bookcm.translator.name != ''}"><tr><td>Dịch giả : </td><td><a href="DichGia.do?save=false&dichgiaid=${book.translator.translatorId}&trang=1&slbooktt=${requestScope.soBookTrenTrang}&kieuSort=${requestScope.kieuSapXep}"><c:out value="${book.translator.name }"></c:out></a></td></tr></c:if>
						<tr><td>Nhà xuất bản: </td><td><c:if test="${bookcm.publisher.name != ''}"><c:out value="${bookcm.publisher.name }"></c:out></c:if></td></tr>
						<tr><td>Giá: </td><td><c:out value="${book.price }"></c:out> VND</td></tr>
						<tr><td>Ngày XB:</td><td><fmt:formatDate value="${bookcm.publishDay }" pattern="dd/MM/yyyy"/></td></tr>
					</tbody>
				</table>
						
					</div>	
			</div>
	</c:if>
	<c:if test="${requestScope.usercm!=null }">
	<c:if test="${requestScope.usercm.status.idstatus == 4 }">
		<a class="btn btn-danger" href="BanTaiKhoan.do?userId=${usercm.userId }">Ban tài khoản này</a>
	</c:if>
	</c:if>
	<div style="width:100%;float:left;">
			<div style="float:left;width:500px;">
			<div style="float:right;width:200px;">
					<label  style="width:100px;margin-top:26px;float:left;font-size:14px;margin-left:10px;">Hiển thị</label>
					 <form style="display:inline;width:60px;float:left;margin-top:23px;" action="${Servlet}&trang=1" method="POST">
					    	<select style="width:60px;" name="slcmtt"  onchange='submit()' >
					    	<c:set var="cmtt" value="${requestScope.soBookTrenTrang }"></c:set>
								<c:forEach var="i" begin="1" end="5">
									<option value="${ i*cmtt }" <c:if test="${i*cmtt==slcmtt }"><c:out value="selected=\"selected\""></c:out></c:if> ><c:out value="${ i*cmtt }"></c:out></option>
								</c:forEach>		
					   		 </select>
					  </form>
			</div>
			</div>
			<div style="float:right;margin:3px;width:430px;">
				<label style="width:50px;margin-top:23px;float:left;font-size:14px;">Trang</label>
				<div class="pagination" style="display:inline;width:380px;float:left;">
					<ul>

						<c:choose>
							<c:when test="${trangHienTai > 1 }">
								<li><a
									href="${Servlet}&trang=${trangHienTai - 1}&slcmtt=${slcmtt}">«</a></li>
							</c:when>
							<c:otherwise>
								<li><a href="#">«</a></li>
							</c:otherwise>
						</c:choose>
						<!-- do dai pagination -->
						<c:choose>
							<c:when test="${tongSoTrang <= 6}">
								<c:forEach var="i" begin="1" end="${tongSoTrang}"
									step="1">
									<c:choose>
										<c:when test="${trangHienTai == i }">
											<li class="active"><a
												href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
											</a></li>
										</c:when>
										<c:otherwise>
											<li><a
												href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
											</a></li>
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<c:choose>
									<c:when test="${trangHienTai <= 3 }">
										<!--  khi page hiện tại là 1 trong 2 page đầu -->
										<c:forEach var="i" begin="1" end="5" step="1">
											<c:choose>
												<c:when test="${trangHienTai == i }">
													<li class="active"><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:when>
												<c:otherwise>
													<li><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:otherwise>
											</c:choose>
										</c:forEach>
										<li><a>...</a></li>
										<li><a
											href="${Servlet}&trang=${tongSoTrang}&slcmtt=${slcmtt}">${tongSoTrang}
										</a></li>
									</c:when>
									<c:when
										test="${trangHienTai >= tongSoTrang - 1 }">
										<!--  khi page hiện tại là 1 trong 2 page cuối -->

										<li><a
											href="${Servlet}&trang=${1}&slcmtt=${slcmtt}">1
										</a></li>
										<li><a>...</a></li>
										<c:forEach var="i" begin="${ tongSoTrang - 4}"
											end="${ tongSoTrang}" step="1">
											<c:choose>
												<c:when test="${trangHienTai == i }">
													<li class="active"><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:when>
												<c:otherwise>
													<li><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</c:when>
									<c:otherwise>
										<c:choose>
											<c:when
												test="${ trangHienTai + 4 <= tongSoTrang }">
												<li><a
													href="${Servlet}&trang=${1}&slcmtt=${slcmtt}">1
												</a></li>
												<li><a>...</a></li>
												<c:forEach var="i" begin="${ trangHienTai - 1}"
													end="${ trangHienTai + 2}" step="1">
													<c:choose>
														<c:when test="${trangHienTai == i }">
															<li class="active"><a
																href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
															</a></li>
														</c:when>
														<c:otherwise>
															<li><a
																href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
															</a></li>
														</c:otherwise>
													</c:choose>
												</c:forEach>

												<li><a>...</a></li>
												<li><a
													href="${Servlet}&trang=${tongSoTrang}&slcmtt=${slcmtt}">${tongSoTrang}
												</a></li>
											</c:when>
											<c:otherwise>
												<li><a
													href="${Servlet}&trang=${1}&slcmtt=${slcmtt}">1
												</a></li>
												<li><a>...</a></li>
												<c:forEach var="i" begin="${ tongSoTrang - 4}"
													end="${ tongSoTrang}" step="1">
													<c:choose>
														<c:when test="${trangHienTai == i }">
															<li class="active"><a
																href="${Servlet}&trang=${i}&slbooktt=${slbooktt}">${i}
															</a></li>
														</c:when>
														<c:otherwise>
															<li><a
																href="${Servlet}&trang=${i}&slbooktt=${slbooktt}">${i}
															</a></li>
														</c:otherwise>
													</c:choose>
												</c:forEach>
											</c:otherwise>
										</c:choose>
									</c:otherwise>

								</c:choose>
							</c:otherwise>
						</c:choose>

						<!-- do dai pagination -->
						<c:choose>
							<c:when
								test="${trangHienTai < tongSoTrang }">
								<li><a
									href="${Servlet}&trang=${trangHienTai + 1}&slbooktt=${slbooktt}">»</a></li>
							</c:when>
							<c:otherwise>
								<li><a href="#">»</a></li>
							</c:otherwise>
						</c:choose>

					</ul>
				</div>
			</div>
		</div>
	<br>
	<table  class="table table-striped" style="text-transform:capitalize;">
		<tr>
			<c:if test="${book==null }"><th style="width: 100px;">Sách id</th></c:if> 
			<th style="width: 80px;">Người gửi</th>
			<th style="width: 226px;">Nội dung</th>
			<th style="width: 70px;">Trạng thái</th>
			<th></th>
		</tr>
		<c:forEach var="cm" items="${requestScope.lcm }">
			<tr>
				<c:if test="${book==null }"><td><a href="LietKeCommentTheoSach.do?bookid=${cm.book.bookId}&slcmtt=${requestScope.soBookTrenTrang}&trang=1&save=false">${cm.book.bookId}<br> ${cm.book.name} </a>
				</td></c:if> 
				<td><a href="LietKeCommentTheoUser.do?userid=${cm.user.userId}&slcmtt=${requestScope.soBookTrenTrang}&trang=1&save=false">${cm.user.userId }</a></td>
				<td>${cm.content }</td>
				<td>${cm.status.status}</td>
				<td><a class="btn btn-success"
					href="CapNhatTrangThaiComment.do?cmid=${cm.commentId }&status=2">
					Duyệt</a> 
					<a class="btn btn-danger"
					href="CapNhatTrangThaiComment.do?cmid=${cm.commentId }&status=3">
					Từ chối</a> 
					<a class="btn btn-inverse"
					href="XoaComment.do?cmid=${cm.commentId }">
					Xóa</a> 
			</tr>
		</c:forEach>
	</table>

	<div style="width:100%;float:left;">
			<div style="float:left;width:500px;">
				<div style="float:right;width:200px;">
					<label  style="width:100px;margin-top:26px;float:left;font-size:14px;margin-left:10px;">Hiển thị</label>
					 <form style="display:inline;width:60px;float:left;margin-top:23px;" action="${Servlet}&trang=1" method="POST">
					    	<select style="width:60px;" name="slcmtt"  onchange='submit()' >
					    	<c:set var="cmtt" value="${requestScope.soBookTrenTrang }"></c:set>
								<c:forEach var="i" begin="1" end="5">
									<option value="${ i*cmtt }" <c:if test="${i*cmtt==slcmtt }"><c:out value="selected=\"selected\""></c:out></c:if> ><c:out value="${ i*cmtt }"></c:out></option>
								</c:forEach>		
					   		 </select>
					  </form>
				</div>
			</div>
			<div style="float:right;margin:3px;width:430px;">
				<label style="width:50px;margin-top:23px;float:left;font-size:14px;">Trang</label>
				<div class="pagination" style="display:inline;width:380px;float:left;">
					<ul>

						<c:choose>
							<c:when test="${trangHienTai > 1 }">
								<li><a
									href="${Servlet}&trang=${trangHienTai - 1}&slcmtt=${slcmtt}">«</a></li>
							</c:when>
							<c:otherwise>
								<li><a href="#">«</a></li>
							</c:otherwise>
						</c:choose>
						<!-- do dai pagination -->
						<c:choose>
							<c:when test="${tongSoTrang <= 6}">
								<c:forEach var="i" begin="1" end="${tongSoTrang}"
									step="1">
									<c:choose>
										<c:when test="${trangHienTai == i }">
											<li class="active"><a
												href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
											</a></li>
										</c:when>
										<c:otherwise>
											<li><a
												href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
											</a></li>
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<c:choose>
									<c:when test="${trangHienTai <= 3 }">
										<!--  khi page hiện tại là 1 trong 2 page đầu -->
										<c:forEach var="i" begin="1" end="5" step="1">
											<c:choose>
												<c:when test="${trangHienTai == i }">
													<li class="active"><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:when>
												<c:otherwise>
													<li><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:otherwise>
											</c:choose>
										</c:forEach>
										<li><a>...</a></li>
										<li><a
											href="${Servlet}&trang=${tongSoTrang}&slcmtt=${slcmtt}">${tongSoTrang}
										</a></li>
									</c:when>
									<c:when
										test="${trangHienTai >= tongSoTrang - 1 }">
										<!--  khi page hiện tại là 1 trong 2 page cuối -->

										<li><a
											href="${Servlet}&trang=${1}&slcmtt=${slcmtt}">1
										</a></li>
										<li><a>...</a></li>
										<c:forEach var="i" begin="${ tongSoTrang - 4}"
											end="${ tongSoTrang}" step="1">
											<c:choose>
												<c:when test="${trangHienTai == i }">
													<li class="active"><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:when>
												<c:otherwise>
													<li><a
														href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
													</a></li>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</c:when>
									<c:otherwise>
										<c:choose>
											<c:when
												test="${ trangHienTai + 4 <= tongSoTrang }">
												<li><a
													href="${Servlet}&trang=${1}&slcmtt=${slcmtt}">1
												</a></li>
												<li><a>...</a></li>
												<c:forEach var="i" begin="${ trangHienTai - 1}"
													end="${ trangHienTai + 2}" step="1">
													<c:choose>
														<c:when test="${trangHienTai == i }">
															<li class="active"><a
																href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
															</a></li>
														</c:when>
														<c:otherwise>
															<li><a
																href="${Servlet}&trang=${i}&slcmtt=${slcmtt}">${i}
															</a></li>
														</c:otherwise>
													</c:choose>
												</c:forEach>

												<li><a>...</a></li>
												<li><a
													href="${Servlet}&trang=${tongSoTrang}&slcmtt=${slcmtt}">${tongSoTrang}
												</a></li>
											</c:when>
											<c:otherwise>
												<li><a
													href="${Servlet}&trang=${1}&slcmtt=${slcmtt}">1
												</a></li>
												<li><a>...</a></li>
												<c:forEach var="i" begin="${ tongSoTrang - 4}"
													end="${ tongSoTrang}" step="1">
													<c:choose>
														<c:when test="${trangHienTai == i }">
															<li class="active"><a
																href="${Servlet}&trang=${i}&slbooktt=${slbooktt}">${i}
															</a></li>
														</c:when>
														<c:otherwise>
															<li><a
																href="${Servlet}&trang=${i}&slbooktt=${slbooktt}">${i}
															</a></li>
														</c:otherwise>
													</c:choose>
												</c:forEach>
											</c:otherwise>
										</c:choose>
									</c:otherwise>

								</c:choose>
							</c:otherwise>
						</c:choose>

						<!-- do dai pagination -->
						<c:choose>
							<c:when
								test="${trangHienTai < tongSoTrang }">
								<li><a
									href="${Servlet}&trang=${trangHienTai + 1}&slbooktt=${slbooktt}">»</a></li>
							</c:when>
							<c:otherwise>
								<li><a href="#">»</a></li>
							</c:otherwise>
						</c:choose>

					</ul>
				</div>
			</div>
		</div>
</div>

<script>

</script>